package decisionalalgorithms.guialgorithms.converters;

import com.sun.istack.Nullable;
import decisionalalgorithms.guialgorithms.commands.InitMatrixCommand;
import decisionalalgorithms.guialgorithms.domain.InitMatrix;
import lombok.Synchronized;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class InitMatrixCommandToInitMatrix implements Converter<InitMatrixCommand, InitMatrix> {
    @Synchronized
    @Nullable
    @Override
public InitMatrix convert(InitMatrixCommand source){
        if (source == null){
            return null;
        }
        final InitMatrix initMatrix = new InitMatrix();
        initMatrix.setId(source.getId());
        initMatrix.setAlgorithm(source.getAlgorithm());
        initMatrix.setMatrixBuildDetails(source.getMatrixBuildDetails());
        return initMatrix;
    }
}
